//引入http模块
var http = require("http");
/**
 * request 获取url传过来的信息
 * response 给浏览器响应信息
 */
http
  .createServer(function (request, response) {
    //设置相应头
    response.writeHead(200, { "Content-Type": "text/plain;charset=utf-8" });
    console.log(request.url);
    //表示给我们页面上输出一句话,并结束响应
    response.end("Hello 你好");
  })
  .listen(8081); //端口

console.log("Server running at http://127.0.0.1:8081/");
